package Jun13.index;

import Jun13.utils.ESUtils;
import org.elasticsearch.action.admin.indices.delete.DeleteIndexRequest;
import org.elasticsearch.action.support.master.AcknowledgedResponse;
import org.elasticsearch.client.RequestOptions;
import org.elasticsearch.client.RestHighLevelClient;

import java.io.IOException;

public class DeleteIndex {

    public static void main(String[] args) throws IOException {
        RestHighLevelClient rest = ESUtils.getRest();//获取ES对象
        DeleteIndexRequest index = new DeleteIndexRequest("user");//创建删除索引对象
        AcknowledgedResponse delete = rest.indices().delete(index, RequestOptions.DEFAULT);//发送删除索引请求
        System.out.println(delete.isAcknowledged());//查看是否删除成功
        rest.close();//关闭资源
    }
}
